package com.ecust.ServletPG;

import javax.servlet.http.*;


public class CommentServer extends HttpServlet {
	
		public void doGet(HttpServletRequest request,HttpServletResponse response){	
		}
		public void doPost(HttpServletRequest request,HttpServletResponse response) {
			HttpSession session = request.getSession();
			String author = (String) session.getAttribute("username");
			try {
				if(author == null){
					String requestURL = request.getRequestURI();
					session.setAttribute("requestURL", requestURL);
					response.sendRedirect("relogin.jsp");
				}else{
					String commentText = request.getParameter("criticism");
					response.sendRedirect("video-player.jsp");
					session.setAttribute("commentText", commentText);
					String commentTime = ff.ecust.elseServer.TimeServer.getCommentTime();
					session.setAttribute("commentTime", commentTime);
					System.out.println(commentText);
				}
			} catch (Exception e) {
				// TODO: handle exception
				e.printStackTrace();
			}
		}
}

